try { 
  $tools = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
  $profFragment = @"
#####BigGit#####
Import-Module $tools\BigGit\BigGit.psm1
"@
  $newProfile = @()
  $profileWritten=$false
  $toggle=$false
  if(Test-Path $profile) {
      $oldProfile = [string[]](Get-Content $PROFILE)
      foreach($line in $oldProfile) {
          if($line -eq "#####BigGit#####"){
              $toggle=!$toggle
              if($toggle) {
                  $newProfile += $profFragment
                  $profileWritten=$True
              }
          }
          if(!$toggle){$newProfile += $line}
      }
  }
  if(!$profileWritten){
      $newProfile += $profFragment
      $newProfile += "#####BigGit#####"        
  }
  New-Item -Force $Profile -type File -value ($newProfile -join "`r`n")
  if(Get-Module BigGit) { Remove-Module BigGit }
  Import-Module $tools\BigGit\BigGit.psm1 -global
  write-host "BigGit is now ready and imported as part of your profile script."

  Write-ChocolateySuccess 'BigGit'
} catch {
  Write-ChocolateyFailure 'BigGit' "$($_.Exception.Message)"
  throw 
}